fix(macOS): Send user agent string over File Provider socket along with account details
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 8 May 2025 05:49:29 +0000 (13:49 +0800)
committerJyrki Gadinger <nilsding@nilsding.org>
Mon, 28 Jul 2025 07:48:16 +0000 (09:48 +0200)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderSocketLineProcessor.swift
src/gui/macOS/fileprovidersocketcontroller.cpp

index c9a49d4190f16e565cf145399c6bf28b39399401..1fd7d2d48fe6fdbf2525a781a4eaed0c7c4f8b68 100644 (file)
@@ -46,14 +46,21 @@ class FileProviderSocketLineProcessor: NSObject, LineProcessor {
             delegate.removeAccountConfig()
         } else if command == "ACCOUNT_DETAILS" {
             guard let accountDetailsSubsequence = splitLine.last else { return }
-            let splitAccountDetails = accountDetailsSubsequence.split(separator: "~", maxSplits: 3)
+            let splitAccountDetails = accountDetailsSubsequence.split(separator: "~", maxSplits: 4)
 
-            let user = String(splitAccountDetails[0])
-            let userId = String(splitAccountDetails[1])
-            let serverUrl = String(splitAccountDetails[2])
-            let password = String(splitAccountDetails[3])
+            let userAgent = String(splitAccountDetails[0])
+            let user = String(splitAccountDetails[1])
+            let userId = String(splitAccountDetails[2])
+            let serverUrl = String(splitAccountDetails[3])
+            let password = String(splitAccountDetails[4])
 
-            delegate.setupDomainAccount(user: user, userId: userId, serverUrl: serverUrl, password: password)
+            delegate.setupDomainAccount(
+                user: user,
+                userId: userId,
+                serverUrl: serverUrl,
+                password: password,
+                userAgent: userAgent
+            )
         }
     }
 }
index afe69acbf189f3f9410e3a529f4994474adf0906..03eb2d10e55eb3baa1ad03cc072b298843555db5 100644 (file)
@@ -18,6 +18,7 @@
 #include <QLoggingCategory>
 
 #include "accountmanager.h"
+#include "common/utility.h"
 #include "fileproviderdomainmanager.h"
 
 namespace OCC {
@@ -237,6 +238,7 @@ void FileProviderSocketController::sendAccountDetails() const
 
     // We cannot use colons as separators here due to "https://" in the url
     const auto message = QString(QStringLiteral("ACCOUNT_DETAILS:") +
+                                 Utility::userAgentString() + "~" +
                                  accountUser + "~" +
                                  accountUserId + "~" +
                                  accountUrl + "~" +